﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quanlynhasach.hethongluutru;
using Quanlynhasach.hethongxuly;
using System.Data;

namespace Quanlynhasach.hethongluutru
{
    class PhieuThuDAO
    {
        public static DataTable LayDanhSachPhieuThu()
        {
            string sql = "SELECT * FROM PhieuThu";
            DataTable dt = database.ExcuQuery(sql);

            return dt;

        }
        public static void ThemPhieuThu(PhieuThuDTO ptDTO)
        {
            string sql;
            sql = "Insert into PhieuThu(NgayThu,SoTienThu,MaKhachHang) values('" + ptDTO.NgayThu + "'," + ptDTO.SoTienThu + "," + ptDTO.MaKhachHang + ")";
           
            database.ExcuNonQuery(sql);

        }
        public static void XoaPhieuThu(PhieuThuDTO ptDTO)
        {
            string sql;
            sql = "delete from PhieuThu where MaPhieuThu= " +ptDTO.MaPhieuThu+ "";
            database.ExcuNonQuery(sql);

        }
        public static void SuaPhieuThu(PhieuThuDTO ptDTO)
        {
            string sql;
            sql = "Update  PhieuThu set NgayThu =('" + ptDTO.NgayThu + "'),SoTienThu=(" + ptDTO.SoTienThu + ") where MaPhieuThu=" + ptDTO.MaPhieuThu + "";
            database.ExcuNonQuery(sql);

        }

    }
}
